import { get } from '@/utils/request';
import Vue from 'vue';
//获取用户code授权
export function getUserCode(parm) {
	return get({
		url: `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${parm.appid}&redirect_uri=${parm.redirect_uri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirec`
	});
}
export function getappid() {
	return get({
		url: Vue.prototype.$conf.baseUrl + "/wepay/getAppId",
		setHeader: () => {
			return (config) => {
				console.log(config);
				config.headers['fromApp'] = 'wechat-ka-cargo-poublic-service';
				return config;
			};
		}
	});
}
export function getopenid(code) {
	return get({
		url: Vue.prototype.$conf.baseUrl + `/wepay/getAccessTokenWithCode?code=${code}`,
		setHeader: () => {
			return (config) => {
				console.log(config);
				config.headers['fromApp'] = 'wechat-ka-cargo-poublic-service';
				return config;
			};
		}
	});
}
